﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace dzs.Web.Outstorage
{
    public partial class ListYSH : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["login"] != null)
                {
                    DataSet ds = Session["login"] as DataSet;

                    int roles_id = Convert.ToInt32(ds.Tables[0].Rows[0]["roles_id"].ToString());
                    int user_id = Convert.ToInt32(ds.Tables[0].Rows[0]["user_id"].ToString());

                    if (roles_id == 4)//审核人员
                    {
                        Bind(user_id);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('您不是审核人员！');</script>");
                    }

                }
                else
                {
                    Maticsoft.Common.MessageBox.Show(this, "由于长时间未操作，登录信息已过期，请重新登陆!");
                }
            }
        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "check")
            {
                if (e.CommandArgument != null)
                {
                    Session.Remove("proid");//去除以前的记录

                    string proid = e.CommandArgument.ToString();

                    Response.Redirect("ShowCheckDetail.aspx?id="+proid);
                }
            }
        }

        private void Bind(int check_user_id)
        {
            dzs.BLL.out_storageList o = new BLL.out_storageList();

            DataSet ds = o.GetCheckUser(" check_user_id=" + check_user_id + " and status = 0 ");

            this.GridView1.DataSource = ds;
            this.GridView1.DataBind();
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            this.GridView1.PageIndex = e.NewPageIndex;

            if (Session["login"] != null)
            {
                DataSet ds = Session["login"] as DataSet;

                int roles_id = Convert.ToInt32(ds.Tables[0].Rows[0]["roles_id"].ToString());
                int user_id = Convert.ToInt32(ds.Tables[0].Rows[0]["user_id"].ToString());

                if (roles_id == 4)//审核人员
                {
                    Bind(user_id);
                }
               

            }
            else
            {
                Maticsoft.Common.MessageBox.Show(this, "由于长时间未操作，登录信息已过期，请重新登陆!");
            }
        }
    }
}